﻿package core.ui.dialogs
{
    import core.enum.*;
    import core.event.*;
    import core.image.*;
    import core.ui.controls.*;
    import core.ui.util.*;
    import flash.events.*;

    public class VignetteDialog extends BitmapOperationDialogBase
    {
        var f:Filter;
        var b:Slidebar;
        var m:Slidebar;
        var color:ColorPad;

        public function VignetteDialog(param1:Tuyitu)
        {
            super(param1, "rm_vignette", 240, 150, Action.VignetteFilter);
            this.f = new Filter();
            this.b = new Slidebar("rm_size", 1, 100, 200, 50);
            this.b.addEventListener(SliderEvent.CHANGE, this.Change, false, 1, true);
            this.b.x = 20;
            this.b.y = 35;
            addChild(this.b);
            this.color = new ColorPad(0, true);
            this.color.addEventListener(MouseEvent.MOUSE_DOWN, this.ColorMouseDown, false, 1, true);
            this.color.addEventListener(ColorPadEvent.CHOOSE_COLOR, this.Change, false, 1, true);
            this.color.x = 180;
            this.color.y = 80;
            addChild(this.color);
            return;
        }// end function

        public function ColorMouseDown(event:MouseEvent) : void
        {
            new ColorPicker(ed, event.target as ColorPad);
            return;
        }// end function

        override public function Change(... args) : void
        {
            if (!locked)
            {
                bm.copyPixels(bc, bm.rect, bm.rect.topLeft);
                this.f.Vignette(bm, this.color.value, this.b.value);
            }
            return;
        }// end function

    }
}
